
    <div class="datagridcontainer" id="dgc<?=$frmtime?>">
        <table>
			<tr  class="h0">
				<td>No.</td>
                <?
                    $col_count = 1; 
                    //print_object($dgcolumns);exit;
                    foreach($dgcolumns as $key => $column) {
                    if($column['visible']) {
                        $widthstr = '';
                        if(isset($column['width'])) {
                            $width = $column['width'];
                            $widthstr = " width=\"".$width."\"";
                        }
                        echo "<td".$widthstr.">".$column['label']."</td>";
                        $col_count++;    
                    }
                    
                } ?>
			</tr>
            
            <?
                $i = ($current_page-1)*$rows_per_page + 1; 
                $total_cols = array();
                foreach($dgitems as $dgitem) {
            ?>
            <tr class="d<?=$i%2?>">
                <td class="tdslno"><?=$i?></td>
            <?
                
                foreach($dgcolumns as $key => $column) {
                    if(isset($column['sum']) && $column['sum'] == true) {
                        if(!isset($total_cols[$key])) {
                            $total_cols[$key] = 0;
                        }
                        $total_cols[$key] += $dgitem[$key];
                    }
                    if($column['visible']) {
                        $colvalue = $dgitem[$key];
                        switch($column['type']) {
                            case 'boolean':
                                    $colvalue = ($colvalue == true) ? 'Yes' : 'No';
                                    break;
                            case 'textarea':
                                    $colvalue = "<textarea style='resize:none' rows='2' cols='30' readonly='true'>".$colvalue."</textarea>";
                                    break;
                            case 'date':
                                    $colvalue = ($colvalue!="0000-00-00") ? date("Y-m-d",strtotime( $colvalue )) : "";
                                    break;
                            case 'enum':
                                    $colvalue =  $column['enum'][$colvalue];
                                    break;  
                            case 'format':
                                    $function = $column['function'];
                                    $params = isset($column['param']) ? $column['param'] : $key;
                                    $colvalue =  format_grid_val($function,$params,$dgitem);
                                    break;
                        }
                        echo "<td>".$colvalue."</td>";
                    }
                }
            ?>
            </tr>
            <?
                    $i++;      
                }
             if(isset($report) && $report == true) {
            ?>
            <tr  class="h0">
				<td colspan="<?=$total_span?>">Total</td>
                <?
                    
                    //print_object($dgcolumns);exit;
                    $i=1;
                foreach($dgcolumns as $key => $column) {
                    $sum_value = "";
                    if($column['sum']) {
                        if($total_cols[$key]){
                            $sum_value = $total_cols[$key];
                        }                    
                    }
                    if($i>=$total_span) {
                        echo "<td>".$sum_value."</td>";
                    }
                    $i++;
                }
                ?>
			</tr>
            <?       
                }            
            ?>
		</table>
  </div>